/* Declarations for dynamic library loading.

   This file is part of khipu.

   khipu is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */

#ifndef __KP_DYNLIB__
#define __KP_DYNLIB__   1

#include "defs.hpp"

KP_DECLS_BEGIN

enum
{
  DYNLIB_LOCAL  = 0x1,
  DYNLIB_APPEXT = 0x2
};

struct interpreter;

KP_EXPORT void* dynlib_open (interpreter *interp,
  const char *path, uint32_t path_len, uint32_t flags);

KP_EXPORT void* dynlib_open (interpreter *interp,
  const char *path, uint32_t flags);

KP_EXPORT void* dynlib_sym (void *dynlib, const char *symbol);

KP_EXPORT void dynlib_close (void *dynlib);

KP_EXPORT const char* dynlib_extension ();

KP_DECLS_END

#endif
